package engine.parsers;

import org.springframework.beans.factory.annotation.Autowired;

import engine.services.IParserClassLoader;


public class ParsersClassLoader extends ClassLoader {
	
	@Autowired
	IParserClassLoader parserClassLoader;
	
	public void setParserClassLoaderHandler(IParserClassLoader parserClassLoader) {
		this.parserClassLoader = parserClassLoader;
	}

	
	public ParsersClassLoader() {
		super(ParsersClassLoader.class.getClassLoader());
	}
	
	@Override
	public Class<?> loadClass(String name) throws ClassNotFoundException {
		IParserClassLoader cl;
		try {
			
			cl = (IParserClassLoader)parserClassLoader.getClass().newInstance();
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		return cl.myFindClass(name);
	}


}
